/*
 * @Author: your name
 * @Date: 2021-09-06 19:47:54
 * @LastEditTime: 2021-10-31 15:27:55
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \ej-customer-cli\src\store\product\product.js
 */
import { post, get } from '@/http/axios'
export default {
  namespaced: true,
  state: {
    products:[],
    findProduct:[]
  },
  mutations: {
    SET_PRODUCT(state,payload){
      state.products=payload
    },
    SET_FINDPRODUCT(state,payload){
      state.findProduct=payload
    },
  },
  actions: {
    //发送产品分页请求并且根据不同栏目获取不同产品
    async findAllProduct({commit},productCategoryId){
      let res = await get('/product/pageQuery',{
        page:1,
        pageSize:100,
        productCategoryId
      })
      commit('SET_PRODUCT',res.data.data.list)
    },
    //获取产品相关信息
    async findAllProductPro({commit}){
      let res = await get('/product/pageQuery',{
        page:1,
        pageSize:100,
      })
      commit('SET_FINDPRODUCT',res.data.data.list)
    },
  } 
}